package edu.zju.gis.dbfg.model.statistic;

import lombok.Getter;
import lombok.Setter;
import org.apache.xerces.impl.dtd.models.CMLeaf;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;

@Getter
@Setter
public class StatisticByValueArgs implements Serializable {
    private final static Logger logger = LoggerFactory.getLogger(StatisticByValueArgs.class);

    @Option(name ="-output", usage = "输出文件路径", required = true)
    private String output;

    @Option(name ="-input", usage = "输入文件", required = true)
    private String input;

    @Option(name ="-type", usage = "输入文件类型", required = true)
    private String type;

    @Option(name ="-idIndex", usage = "id字段", required = true)
    private String idIndex;

    @Option(name ="-summarizeIndex", usage = "汇总字段", required = true)
    private String summarizeIndex;

    @Option(name ="-areaIndex", usage = "面积字段", required = true)
    private String areaIndex;

    @Option(name ="-crs", usage = "坐标系", required = true)
    private String crs;

    public static StatisticByValueArgs initArgs(String args[]){
        StatisticByValueArgs mArgs = new StatisticByValueArgs();
        CmdLineParser parser = new CmdLineParser(mArgs);
        try{
            parser.parseArgument(args);
            return mArgs;
        }catch (CmdLineException e){
            logger.error(e.getLocalizedMessage());
            return null;
        }
    }

}
